﻿using System;
using System.Windows;
using Milkify.Interfaces;

namespace Milkify
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        [STAThread]
        public static void Main(string[] args)
        {
            KernelContainer.Initialize();

            App app = new App();

            IMainWindowController controller = KernelContainer.Kernel.Get<IMainWindowController>();
            controller.Execute();
            app.Run(controller.MainWindow);
            controller.Dispose();

            KernelContainer.Shutdown();
        }

        private ApplicationExceptionHandler mExceptionHandler;

        public App()
        {
            InitializeComponent();
            InitializeExceptionHandler();
        }

        private void InitializeExceptionHandler()
        {
            mExceptionHandler = KernelContainer.Kernel.Get<ApplicationExceptionHandler>();
        }
    }
}
